This repository has been archived by the owner on Nov 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
andresdlt03
approved these changes
Oct 25, 2023
andresdlt03
reviewed
Nov 2, 2023
andresdlt03
approved these changes
Nov 2, 2023
msanlli
approved these changes
Nov 3, 2023
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement the TCP logic. There are two main parts to it: the
TCPSource
and theTCPConn
.TCPSource
exists because for each board we can either establish a connection as a server or as a client. The structTCPClient
is aTCPSource
for single direct connections and the structTCPServer
for multiple connections. This allows to abstract the "establishing connection" from the "using connection logic". Sources run and notify when a connection is made through callbacks.TCPClient
retries to reconnect if the connection fails using an exponential backoff. Once the connection is created,TCPConn
is in charge of notifying disconnections and external logic should handle calling againTCPClient.Run()
TCPServer
creates a TCP listener and accepts connections specified on a list.TCPConn
allows to read and write from the connection, it also provides a callback to notify when the connection status changes (sendstrue
when connected andfalse
when disconnected).